package sctu.edu.java.year2016.team04.luoxinghua.day20160521.InsertSort;



/**
 * Created by 落叶的思恋 on 2016/6/20.
 */

public class InsertOrder {
    public static void main(String[] args) {
        int[] intarray = new int[]{20, 40, 90, 30, 80, 70, 50};
        int j;
        int temp;
        for (int i = 1; i < intarray.length; i++) {
            temp=intarray[i];
            for (j = i-1; j >= 0 && (temp < intarray[j]); j--) {

                intarray[j + 1] = intarray[j];

            }
            intarray[j+1] = temp;
        }
        System.out.println("After Ordering is");
        for (int i=0;i<intarray.length;i++)
            System.out.print(intarray[i]+" ");

    }
}
